package volatileDemo;

/**
 * @author wang'ji'cheng
 * @date 2025/8/7
 */
public class Demo1Test {
    public static void main(String[] args) {

        Demo01 demo1Test = new Demo01();
        demo1Test.start();
        //主线程打印，主线程会受到影响
        while (true) {
            synchronized (Demo1Test.class){
                if(demo1Test.isFlag()){
                    System.out.println("读到true了吗");
                }
            }


        }
    }
}
